<%--
  Created by IntelliJ IDEA.
  User: 许正雄
  Date: 2021/12/17
  Time: 17:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" href="/static/css/style.css" />
    <script type="text/javascript" src="/static/scripts/function.js"></script>
    <script type="text/javascript" src="static/jquery3.6.0.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#exit").click(function () {
                let msg="是否确定退出登录？？";
                if(confirm(msg)==true){
                    return true;
                }else {
                    return false;
                }
            })
        })
    </script>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="http://localhost/images/qdn_log.jpg" style="width: 120px;height: 60px" /></div>
    <div style="width: 900px;height: 60px"><font color=#9A0F0A style="
                        width: 960px;
                        text-align: center;
                        height: 60px;
                        display: block;
                        line-height: 50px;
                        font-size: 22px;
                        font-weight: bold;
                        font-family: 微软雅黑;
                        padding-bottom: 20px;"
    >黔东南民族文化展示平台</font></div>
    <div class="help">
        <span>
             <a href="selectByCustomerId?id=${customerSession.id}"> ${customerSession.customerName}<c:if test="${customerSession.customerSex==0}">先生</c:if><c:if test="${customerSession.customerSex==1}">女士</c:if></a>
        </span>
        <a href="index.jsp" id="exit">退出登录</a>
</div>
<%@include file="head1.jsp"%>
<div id="main" class="wrap">
    <%@include file="left1.jsp"%>
    <div id="product" class="main">
<%--        <h1>${showAll.showName}</h1>--%>
        <div class="infos">
            <div class="side">
                <div class="spacer"></div>
                <div class="news-list">
                    <h4>新闻动态</h4>
                    <ul>
                        <marquee direction="up" behavior="scroll" onMouseOut="this.start()" onMouseOver="this.stop()" scrollamount="5">
                            <c:forEach items="${newsList}" var="news">
                                <li>
                                    <a href="/manage/selectNewsById?id=${news.id}" target="_blank">${news.title}</a><br/><a href="/manage/selectNewsById?id=${news.id}"></a>
                                </li>
                            </c:forEach>
                        </marquee>
                    </ul>
                </div>
            </div>
            <div class="thumb"><img width="300px" height="300px" src="http://localhost/${showAll.showPhotoUrl}" /></div>
            <div class="container">
                <p>名称：${showAll.showName}</p>
                <p>类型：<span class="">${showAll.showTypeName}</span></p>
                <p>描述：<span class="introduce">${showAll.remark}<br><br></span></p>
<%--                <div class="button"><input type="button" name="button" value="" onclick="goBuy(${product.id})" /><a href="javascript:addShopCart(${product.id})">放入购物车</a></div>--%>
            </div>
            <div class="clear"></div>
        </div>
        <div class="introduce">
            <h2><strong>留言</strong></h2>
            <div class="text">
                <div>
                    <ul>
                        <marquee direction="up" behavior="scroll" onMouseOut="this.start()" onMouseOver="this.stop()" scrollamount="3">
                            <c:forEach items="${guestBooks}" var="guest">
                                <li>
                                    <span>${guest.customerNickName}：${guest.content}</span> &nbsp&nbsp&nbsp ${guest.guestBookTime}
                                </li>
                            </c:forEach>
                        </marquee>
                    </ul>
                </div>
                <form id="frm">
                    <table class="form">
                        <tr>
                            <td class="field">留言内容：</td>
                            <td><textarea name="content"></textarea></td>
                            <td><input type="hidden" name="customerId" value="${customerSession.id}"/></td>
                            <td><label class="ui-blue"><button type="button" id="ins" >添加留言</button></label></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
</div>
</body>
<script type="text/javascript">
    $(function () {
        $("#ins").click(function () {
            $.ajax({
                url:"/manage/insertGuestBook",
                type:"post",
                data:$("#frm").serialize(),
                success:function (ret) {
                    if (ret*1===1){
                        alert("留言成功！")
                        window.location.href="findShowById?showId=${showAll.id}";
                    }
                    if (ret === 0){
                        alert("留言失败！")
                        window.location.href="findShowById?showId=${showAll.id}";
                    }
                }
            })
        })
    })
</script>
</html>

